<template>
	<view class="content">
		<view class="dpigqb">
			<view>
				<view class="">
					<view class="information" @click="open" v-if="!adressinfo.addr">
						<view class="number">
							<view>选择收货地址</view>
							<view>更换 <uni-icons type="right" size="14" color="#333"></uni-icons></view>
						</view>
					</view>
					<view class="information" @click="open" v-if="adressinfo.addr">
						<view class="number">
							<view>收件人：{{adressinfo.name}} {{adressinfo.mobile}}</view>
							<view>更换 <uni-icons type="right" size="14" color="#333"></uni-icons></view>
						</view>
						<view class="numbera">
							<view>地址：{{adressinfo.addrAoi}}{{adressinfo.addrHouse}}</view>
						</view>
					</view>
					<view class="information">
						<!-- 						<view class="informationtitle">
							课程信息
						</view> -->
						<view class="introduce" v-for="item,index in gouwucheinfo.list" :key="index">
							<view class="img">
								<image :src="item.picture" mode=""></image>
							</view>
							<view class="introduce-text">
								<view class="introduce-name">
									{{item.goodsName}}
								</view>
								<view class="gift">
									{{item.specName}}
								</view>
								<view class="points">
								</view>
								<view class="introduce-price">
									<view class="originalprice" v-if="item.price!=='0.00'"> ￥{{item.price}}
									</view>
									<view class="multiple"> X{{item.num}}
									</view>
								</view>
							</view>
						</view>
					</view>
					<!-- 					<view class="payment">
						<view class="listb">
							<view class="title">
								积分（共{{totalpoints}}积分）
							</view>
							<view class="moneyhong">
								<input type="text" placeholder="请输入积分" style="width: 200rpx;" />
							</view>
						</view>
					</view> -->
					<view class="payment">
						<view class="listb">
							<view class="titlehui"> 支付方式 </view>
						</view>
						<!-- <view class="listc" @click="selectOption('zfb')">
							<view class="title">
								<image class="zfb" src="../../static/323.png" mode=""></image>
								支付宝
							</view>
							<view class="moneyhong">
								<image :src="selectedOption === 'zfb' ? '../../static/352.png' : '../../static/350.png'"
									mode=""></image>
							</view>
						</view> -->
						<view class="listd" @click="selectOption('wx')">
							<view class="title">
								<image class="wx" src="../../static/324.png" mode=""></image> 微信
							</view>
							<view class="moneyhong">
								<image :src="selectedOption === 'wx' ? '../../static/352.png' : '../../static/350.png'"
									mode=""></image>
							</view>
						</view>
					</view>
					<view class="payment">
						<!-- 	<view class="listb">
							<view class="titlehui"> 支付方式 </view>
						</view> -->
						<!-- 	<view class="liste">
							<view class="title"> 商品总价: </view>
							<view class="moneyhong">
								<text v-if="gouwucheinfo.packPrice"> (打包费:</text>
								<text style="color:#ef5050;"
									v-if="gouwucheinfo.packPrice">￥{{gouwucheinfo.packPrice}}</text>
								<text v-if="gouwucheinfo.packPrice">)</text>
							</view>
						</view> -->
						<!-- 			<view class="listf">
							<view class="title">
							</view>
							<view class="moneyhong"> 支付金额： <text>￥{{sumprice.payPrice}}</text>
							</view>
						</view> -->
					</view>
				</view>
			</view>
		</view>
		<view class="bottom">
			<view class="money">
				<text>待支付：</text>
				<text class="hong">￥{{sumprice.payPrice}}</text>
			</view>
			<button @click="tozhifuyemian">确认</button>
			<!-- <button @click="tozhifuyemian">领取</button> -->
		</view>
		<uni-popup ref="popup" type="bottom" border-radius="22px 22px 0 0">
			<view class="adresstit">
				<view @click="close" class="quxiao">取消</view>
				<view class="tit">我的收货地址</view>
				<view @click="totianxieDizhi(0,{})" class="wancheng">添加收货地址</view>
			</view>
			<scroll-view class="adressboxs" scroll-y>
				<view @click="chooseadressfunc(item)" v-for="item,index in adressList" :key='index' class="adressitem">
					<image v-if="adressinfo.id == item.id" class="leftimage" src="../../static/352.png">
					</image>
					<view class="cebtebtbox">
						<view class="adresstext">{{item.addrAoi}}{{item.addrHouse}}</view>
						<view class="adresslianxi">{{item.name}} {{item.mobile}}</view>
					</view>
					<image @click.stop="totianxieDizhi(1,item)" class="rightimage"
						src="../../static/dingdan_bianji.png">
					</image>
				</view>
			</scroll-view>
			<!-- <view @click="adressonClose" class="addadressbtn">完成</view> -->
			<view class="adressxian"></view>
		</uni-popup>
	</view>
</template>
<script>
	const formatdayTime = date => {
		console.log(date)
		date = new Date(parseInt(date))
		const year = date.getFullYear()
		const month = date.getMonth() + 1
		const day = date.getDate()
		return [year, month, day].map(formatNumber).join('-')
	}
	const formatNumber = n => {
		n = n.toString()
		return n[1] ? n : '0' + n
	}
	import {
		clearCart, //清空购物车
		getShopInfo, // 店铺详情
		memberCartList, // 我的购物车
		getMemberAddresses, // 获取用户的  地址列表
		computeConformPromo, // 获取所有的可以用的    优惠活动
		getDeliveryAmount, // 获取配送费 获取默认常用地址
		OrderForOne, //商品下订单
		calculatePrice, //计算价格
		getPointByMemberId, //积分总数
		orderPay,
		freeGoods
	} from "../../request/api.js"
	const hours = []
	const minnits = []
	for (let i = 0; i <= 23; i++) {
		hours.push(i)
	}
	for (let j = 0; j <= 59; j++) {
		minnits.push(j)
	}
	export default {
		data() {
			return {
				uid: '',
				shopid: '',
				hours: hours,
				minnits: minnits,
				day: 0,
				hour: 0,
				minnit: 0,
				timeStr: '',
				value: [0, 0, 0],
				daylist: ['今天', '明天'],
				timeshow: false, //时间弹唱
				shopinfo: {},
				gouwucheinfo: {
					list: [],
					totalMoney: 0
				},
				peisongindex: 1, //1配送 2自取
				showmore: 1, //1展示查看更多    2收起更多   3 不展示
				adressinfo: {},
				adressList: [],
				adressShow: false, //选择地址弹窗
				distance: 0,
				peisongfinfo: {
					distanceAmount: 0
				},
				beuzhu: '',
				sumprice: {
					payPrice: 0,
					peisongprice: 0,
					groupAmount: 0,
					sumPrice: 0,
				},
				ziquphoneval: '',
				ziqunameval: '',
				youhuilists: [], //满足的所有优惠活动
				youhuiprices: 0,
				selectedOption: 'wx',
				totalpoints: 0,
				orderdetails: {},
				isDisable: false
			}
		},
		onLoad(options) {
			this.getPointByMemberIda()
			let that = this
			if (uni.getStorageSync('userInfo').id) {
				that.uid = uni.getStorageSync('userInfo').id
			}
			if (!options.a) {
				console.log('kkkkkkk');
				that.getshopinfos()
			} else {
				// that.getshopinfosa()
				that.groupbuyingproducts = JSON.parse(options.a)
				that.gouwucheinfo.totalMoney = that.groupbuyingproducts.price
				that.gouwucheinfo.goodid = that.groupbuyingproducts.goodsId
				that.gouwucheinfo.list.push(that.groupbuyingproducts)
				console.log(that.gouwucheinfo.list, '啊啊啊啊啊啊啊啊');
			}
			that.shopid = options.shopid
			console.log(that.shopid, '都不');
			// that.getshopinfos()
		},
		onShow() {
			this.getaddressSel()
		},
		methods: {
			clearThisCart() {
				let that = this;
				clearCart({
					memberId: that.uid,
					shopId: that.shopid,
				}).then(res => {
					uni.hideLoading()
					console.log(res, '提交订单后，清空购物车');
				})
			},
			getPointByMemberIda() {
				getPointByMemberId({
					memberId: uni.getStorageSync('userInfo').id
				}).then(res => {
					console.log(res, '积分');
					this.totalpoints = res.result.sumPoint
				})
			},
			selectOption(option) {
				this.selectedOption = option;
				console.log(this.selectedOption);
			},
			open(item) {
				// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ，type 属性将失效 ，仅支持 ['top','left','bottom','right','center']
				this.$refs.popup.open('bottom')
			},
			close() {
				this.$refs.popup.close()
			},
			// 弹出选择时间弹窗
			showtimePopup() {
				let that = this
				var timestamp = new Date();
				var hour = timestamp.getHours()
				var minute = timestamp.getMinutes()
				console.log(hour, minute)
				that.value = [0, hour, minute]
				that.timeshow = true
				that.day = 0
				that.hour = hour
				that.minnit = minute
			},
			qudingtime() {
				let timestamp
				let that = this
				if (this.day == 0) {
					timestamp = Date.parse(new Date());
				} else {
					timestamp = Date.parse(new Date()) + 86400000;
				}
				let chooseTime = formatdayTime(timestamp) + ' ' + formatNumber(this.hours[this.hour]) + ':' + formatNumber(
					this.minnits[this.minnit])
				let nowTime = Date.parse(new Date())
				if (Date.parse(new Date(chooseTime)) - nowTime < 0) {
					uni.showToast({
						title: '发单时间至少为20分钟以后',
						icon: 'none'
					})
					this.timeStr = ''
					that.timeonClose()
				} else if (Date.parse(new Date(chooseTime)) - nowTime < 1210000) {
					uni.showToast({
						title: '发单时间至少为20分钟以后',
						icon: 'none'
					})
					this.timeStr = ''
					that.timeonClose()
				} else {
					this.value = [this.day, this.hour, this.minnit]
					this.timeStr = chooseTime
					that.timeonClose()
				}
			},
			timeonClose() {
				this.timeshow = false
			},
			// 提交订单
			tozhifuyemian() {
				let that = this
				if (that.isDisable) {
					uni.showToast({
						title: '超出配送地址',
						icon: 'none'
					})
					return
				}
				if (!this.adressinfo.addr) {
					uni.showToast({
						title: '请选择收货地址',
						icon: 'none'
					})
					return
				}
				uni.showLoading({
					title: '下单中..',
				})
				if (that.tijiaoflag) {
					return
				}
				that.tijiaoflag = true
				let obj
				let orderLineList = []
				let shopPromoHisList = []
				that.gouwucheinfo.list.forEach(goodsitem => {
					orderLineList.push({
						goodsId: goodsitem.goodsId,
						goodsName: goodsitem.goodsName,
						nameStr: goodsitem.specName,
						quantity: goodsitem.num,
						remark: "",
						specHisId: goodsitem.specId,
						totalPrice: ((goodsitem.price * 1) * (goodsitem.num * 1)).toFixed(2)
					})
				})
				that.youhuilists.forEach(yhitem => {
					shopPromoHisList.push({
						id: yhitem.id
					})
				})
				if (that.peisongindex == 1) {
					obj = {
						enableGroup: false,
						groupPayMoney: that.sumprice.groupAmount,
						addressId: that.adressinfo.id,
						memberId: that.uid,
						couponId: 0,
						merchantId: '110',
						goodId: that.gouwucheinfo.goodid,
						orderDelivery: {
							address: that.adressinfo.addrAoi + that.adressinfo.addrHouse,
							deliveryAmount: that.peisongfinfo.distanceAmount,
							deliveryType: 1,
							distance: that.peisongfinfo.distance,
							lat: that.adressinfo.lat,
							lng: that.adressinfo.lng,
							location: that.adressinfo.lng + ',' + that.adressinfo.lat,
							mobile: that.adressinfo.mobile,
							name: that.adressinfo.name,
							sex: that.adressinfo.sex
						},
						orderLineList: orderLineList,
						payMoney: that.sumprice.sumPrice,
						promoMoney: that.youhuiprices,
						remake: that.beuzhu,
						shopId: that.shopid,
						shopPromoHisList: shopPromoHisList,
						source: 1,
						totalMoney: that.gouwucheinfo.totalMoney,
						type: 2,
					}
				} else {
					obj = {
						enableGroup: false,
						groupPayMoney: that.sumprice.groupAmount,
						memberId: that.uid,
						couponId: 0,
						merchantId: '110',
						goodId: that.gouwucheinfo.goodid,
						orderDelivery: {
							mobile: that.ziquphoneval,
							name: that.ziqunameval,
						},
						orderLineList: orderLineList,
						payMoney: that.sumprice.sumPrice,
						promoMoney: that.youhuiprices,
						remake: that.beuzhu,
						shopId: that.shopid,
						shopPromoHisList: shopPromoHisList,
						source: 1,
						totalMoney: that.gouwucheinfo.totalMoney,
						type: 3,
					}
				}
				console.log(obj);
				OrderForOne(obj).then(responts => {
					this.orderdetails = responts.result
					setTimeout(function() {
						uni.hideLoading()
					})
					setTimeout(function() {
						if (responts.success) {
							that.clearThisCart()
							if (that.sumprice.payPrice !== 0) {
								that.zhifubtn()
							} else {
								that.fee(responts)
							}
						} else {
							uni.showToast({
								title: '提交订单：' + responts.message,
								icon: 'none'
							})
						}
						that.tijiaoflag = false
					})
				}).catch(error => {
					setTimeout(function() {
						that.tijiaoflag = false
						uni.hideLoading()
					})
				})
			},
			fee(responts) {
				console.log(responts, 'responts');
				freeGoods({
					orderNum: responts.result.id
				}).then(res => {
					if (res.code == 200) {
						// uni.showToast({
						// 	title: '购买成功',
						// 	icon: 'none'
						// })
						uni.navigateTo({
							url: '/pages/my/orderdetails?ordernum=' + responts.result.id,
						})
					}
					console.log(res);
				})
			},
			zhifubtn() {
				let that = this
				uni.showLoading({
					title: '加载中',
				})
				// if (that.dianjiflag) {
				// 	that.dianjiflag = false
				// } else {
				// 	return
				// }
				orderPay({
					orderId: that.orderdetails.id,
					payMoney: that.orderdetails.payMoney,
					payType: "W02",
					// openId: that.openid,
					type: 0,
				}).then(responts => {
					setTimeout(function() {
						uni.hideLoading()
					})
					console.log(responts, '凄凄切切')
					setTimeout(function() {
						if (responts.success) {
							let ressuccess = JSON.parse(responts.result)
							console.log(ressuccess, 'dddddd');
							uni.requestPayment({
								"provider": "wxpay",
								"orderInfo": {
									"appid": ressuccess.appid, // 微信开放平台 - 
									"noncestr": ressuccess.noncestr, // 随机字符串
									"package": ressuccess.package, // 固定值
									"partnerid": ressuccess.partnerid, // 微信支付商户号
									"prepayid": ressuccess.prepayid, // 统一下单订单号
									"timestamp": ressuccess.timestamp, // 时间戳（单位：秒）
									"sign": ressuccess.sign // 签名，这里用的 MD5/RSA 签名
								},
								'success': function(res) {
									console.log(res)
									uni.showModal({
										title: '提示',
										content: "支付成功！",
										showCancel: false,
										success: function(res) {
											if (that.type == 2) {
												uni.navigateBack()
											} else {
												uni.redirectTo({
													url: '/pages/my/orderdetails?ordernum=' +
														that.orderdetails
														.id,
												})
											}
										}
									})
								},
								'fail': function(res) {
									console.log(res, '失败原因')
									uni.showModal({
										title: '提示',
										content: "支付失败！",
										showCancel: false,
										success: function(res) {
											if (that.type == 2) {
												uni.navigateBack()
											} else {
												uni.redirectTo({
													url: '/pages/my/orderdetails?ordernum=' +
														that.orderdetails
														.id,
												})
											}
											that.dianjiflag = true
										}
									})
								}
							})
						} else {
							console.log("错误")
							uni.showToast({
								title: responts.message,
								icon: 'none'
							})
							that.dianjiflag = true
						}
					})
				}).catch(error => {
					setTimeout(function() {
						uni.hideLoading()
					})
					that.dianjiflag = true
				})
			},
			// 添加备注页面
			tobeizhuye() {
				uni.navigateTo({
					url: '/pages/tianxieremarks/index?beizhu=' + this.beuzhu
				})
			},
			//  计算价格
			jisuanprice() {
				console.log('进入计算')
				let that = this
				let obj
				let orderLineList = []
				that.gouwucheinfo.list.forEach(goodsitem => {
					orderLineList.push({
						goodsId: goodsitem.goodsId,
						goodsName: goodsitem.goodsName,
						nameStr: goodsitem.specName + ' ' + goodsitem.attributeStr,
						quantity: goodsitem.num,
						remark: "",
						specHisId: goodsitem.specId,
						totalPrice: ((goodsitem.price * 1) * (goodsitem.num * 1)).toFixed(2)
					})
				})
				if (that.peisongindex == 1) {
					obj = {
						enableGroup: false,
						memberId: that.uid,
						merchantId: '110',
						orderDelivery: {
							// address: that.adressinfo.addr + that.adressinfo.addrAoi + that.adressinfo.addrHouse,  // 精简地址
							address: that.adressinfo.addrAoi + that.adressinfo.addrHouse,
							deliveryType: 1,
							lat: that.adressinfo.lat,
							lng: that.adressinfo.lng,
							location: that.adressinfo.lng + ',' + that.adressinfo.lat,
							mobile: that.adressinfo.mobile,
							name: that.adressinfo.name,
							sex: that.adressinfo.sex
						},
						orderLineList: orderLineList,
						promoMoney: that.youhuiprices,
						shopId: that.shopid,
						type: 1
					}
				} else {
					obj = {
						enableGroup: false,
						memberId: that.uid,
						merchantId: '110',
						orderDelivery: {
							mobile: that.ziquphoneval,
							name: that.ziqunameval,
						},
						orderLineList: orderLineList,
						promoMoney: that.youhuiprices,
						shopId: that.shopid,
						type: 2
					}
				}
				uni.showLoading({
					title: '计算中',
				})
				console.log(obj, "计算价格信息");
				calculatePrice(obj).then(res => {
					uni.hideLoading();
					console.log(res);
					if (res.success) {
						this.isDisable = false
						this.distance = res.result.distance
						this.peisongfinfo = {
							distance: res.result.distance,
							distanceAmount: res.result.distanceAmount
						}
						// this.sumprice = res.result.sumPrice;
						this.sumprice = {
							payPrice: res.result.sumPrice,
							sumPrice: res.result.sumPrice,
							peisongprice: res.result.distanceAmount,
							timePrice: res.result.timePrice,
							weatherPrice: res.result.weatherPrice,
							groupAmount: res.result.groupAmount
						}
					} else {
						this.isDisable = true
						uni.showToast({
							title: res.message,
							icon: 'none'
						})
					}
				}).catch(error => {
					uni.hideLoading()
				})
			},
			// 修改 地址
			totianxieDizhi(num, obj) {
				console.log(num, obj)
				this.adressinfo = {}
				if (num == 1) {
					uni.navigateTo({
						url: '../tianxieadress/index?type=1&flag=set&adressinfo=' + JSON.stringify(obj)
					})
				} else {
					uni.navigateTo({
						url: '../tianxieadress/index?type=1&flag=add&adressinfo={}'
					})
				}
			},
			// // 获取配送费 获取默认常用地址
			getDeliveryPrice() {
				uni.showLoading({
					title: '加载中',
				})
				const that = this;
				getDeliveryAmount({
					memberId: that.uid,
					shopId: that.shopid,
					gpsFromLat: that.adressinfo.lat,
					gpsFromLng: that.adressinfo.lng,
					gpsToLat: that.shopinfo.lat,
					gpsToLng: that.shopinfo.lng,
					amount: that.gouwucheinfo.totalMoney
				}).then(responts => {
					setTimeout(function() {
						uni.hideLoading()
					})
					setTimeout(function() {
						console.log(responts)
						if (responts.success) {
							that.distance = responts.result.distance
							that.peisongfinfo = responts.result
							that.jisuanprice()
						} else {
							uni.showToast({
								title: '获取配送费：' + responts.message,
								icon: 'none'
							})
						}
					})
				}).catch(error => {
					setTimeout(function() {
						console.log(error)
						uni.hideLoading()
					})
				})
			},
			// 选择地址
			chooseadressfunc(item) {
				let that = this
				console.log(item, "选中的地址");
				this.adressinfo = item
				that.sumprice = {
					payPrice: 0,
					peisongprice: 0
				}
				that.jisuanprice();
				this.$refs.popup.close()
				// if (that.data.adressinfo.lat && that.data.shopinfo.lat && that.data.gouwucheinfo.weight) {
				// 	this.getdis()
				// }
			},
			// 获取所有的地址
			getaddressSel() {
				uni.showLoading({
					title: '加载中',
				})
				const that = this;
				getMemberAddresses({
					memberId: that.uid
				}).then(responts => {
					setTimeout(function() {
						uni.hideLoading()
					})
					setTimeout(function() {
						console.log(responts)
						if (responts.success) {
							that.adressList = responts.result
						} else {
							uni.showToast({
								title: '获取地址列表：' + responts.message,
								icon: 'none'
							})
						}
					})
				}).catch(error => {
					setTimeout(function() {
						console.log(error)
						uni.hideLoading()
					})
				})
			},
			// 显示 地址选择
			adressshowfun() {
				this.adressShow = true
			},
			// 关闭  地址
			adressonClose() {
				this.adressShow = false
			},
			// 选择配送  还是自提
			xuanzepeisongf(num) {
				let that = this
				this.peisongindex = num
				// return
				if (num == 2) {
					if (that.gouwucheinfo.totalMoney) {
						this.jisuanprice()
					} else {
						setTimeout(() => {
							that.xuanzepeisongf(2)
						}, 500)
					}
				} else {
					this.sumprice = JSON.parse(JSON.stringify({
						payPrice: 0,
						peisongprice: 0
					}))
					if (that.adressinfo.lat && that.shopinfo.lat) {
						this.getDeliveryPrice()
					}
				}
			},
			// 获取所有的可以用的    优惠活动
			getyouhuis() {
				let that = this
				let list = []
				let oldlist = that.gouwucheinfo.list
				oldlist.forEach(item => {
					list.push({
						goodsId: item.goodsId,
						specHisId: item.specId,
						quantity: item.num
					})
				})
				computeConformPromo({
					shopId: that.shopid,
					orderLineList: list,
					memberId: that.uid
				}).then(responts => {
					console.log(responts, '所有的优惠')
					if (responts.success) {
						that.youhuilists = responts.result
						let price = 0
						responts.result.forEach(items => {
							price = price + items.discount
						})
						that.youhuiprices = price.toFixed(2)
					} else {
						that.youhuilists = []
						that.youhuiprices = 0
					}
				}).catch(error => {
					that.youhuilists = []
					that.youhuiprices = 0
					console.log(error)
				})
			},
			// 获取购物车信息
			getgouwucinfo() {
				let that = this
				uni.showLoading({
					title: '加载中'
				})
				memberCartList({
					shopId: that.shopid,
					memberId: that.uid
				}).then(responts => {
					console.log(responts)
					if (responts.success) {
						setTimeout(function() {
							uni.hideLoading()
						})
						let lengthnum = 0
						let resobj = responts.result
						let price = 0
						let chajia = 0
						let xiadan = false
						let packPrice = 0
						let dabao = true
						for (let i = 0; i < resobj.length; i++) {
							lengthnum = lengthnum + resobj[i].num * 1
							if ((resobj[i].packFee * 1) != 0) {
								dabao = false
							}
							price = (price * 1 + (resobj[i].price * 1 + resobj[i].packFee * 1) * resobj[i].num * 1)
								.toFixed(2)
							packPrice = (packPrice * 1 + resobj[i].packFee * 1 * resobj[i].num * 1).toFixed(2)
							if (packPrice == 0) {
								packPrice = 0
							}
						}
						if (dabao && resobj.length > 0) {
							packPrice = (that.shopinfo.shopTakeout.pack * 1).toFixed(2)
							if (packPrice == 0) {
								packPrice = 0
							}
							price = (price * 1 + packPrice * 1).toFixed(2)
						}
						if (resobj.length > 0) {
							chajia = (that.shopinfo.shopTakeout.startFare * 1 - price * 1).toFixed(2)
							if (chajia > 0) {
								xiadan = false
							} else {
								xiadan = true
							}
							that.gouwucheinfo = {
								totalMoney: price,
								chajia: chajia,
								xiadan: xiadan,
								lengthnum: lengthnum,
								list: resobj,
								packPrice: packPrice
							}
						} else {
							xiadan = false
							chajia = that.shopinfo.shopTakeout.startFare * 1
							that.gouwucheinfo = {
								totalMoney: price,
								chajia: chajia,
								xiadan: xiadan,
								lengthnum: lengthnum,
								list: resobj,
								packPrice: 0
							}
							that.gouwucheTc = false
						}
						that.getyouhuis()
					} else {
						setTimeout(function() {
							uni.hideLoading()
						})
						setTimeout(function() {
							uni.showToast({
								title: '获取购物车信息：' + responts.message,
								icon: 'none'
							})
						})
					}
				}).catch(error => {
					setTimeout(function() {
						console.log(error)
						uni.hideLoading()
					})
				})
			},
			// 获取店铺信息
			getshopinfos() {
				let that = this
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				console.log(that.shopid, '店铺详情')
				let goods = {
					id: '1507610418441297922'
				}
				getShopInfo(goods).then(responts => {
					console.log(responts, '店铺详情')
					if (responts.success) {
						setTimeout(function() {
							uni.hideLoading()
						})
						that.shopinfo = responts.result
						that.getgouwucinfo()
					} else {
						setTimeout(function() {
							uni.hideLoading()
						})
						setTimeout(function() {
							uni.showToast({
								title: '获取店铺详情：' + responts.message,
								icon: 'none'
							})
						})
					}
				}).catch(error => {
					setTimeout(function() {
						uni.hideLoading()
					})
				})
			},
		}
	}
</script>
<style scoped lang="less">
	/* 地址选择的标题 */
	.adresstit {
		width: 100%;
		height: 82rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		position: relative;
		background-color: #ffffff;
		border-bottom: 2rpx solid #eee;
		font-size: 26rpx;
		color: #999999;

		.quxiao {
			position: absolute;
			top: 0;
			left: 0;
			color: #333333;
			height: 82rpx;
			line-height: 82rpx;
			padding: 0 28rpx;
		}

		.wancheng {
			position: absolute;
			top: 0;
			right: 0;
			color: #ef5050;
			height: 82rpx;
			line-height: 82rpx;
			padding: 0 28rpx;
		}
	}

	/* 地址列表 */
	.adressboxs {
		background-color: #ffffff;
		width: 100%;
		height: 610rpx;
		border-bottom: 2rpx solid #eee;
		box-sizing: border-box;

		.adressitem {
			height: 128rpx;
			box-sizing: border-box;
			padding: 0 84rpx;
			border-bottom: 2rpx solid #eee;
			display: flex;
			align-items: center;
			position: relative;

			.leftimage {
				position: absolute;
				left: 28rpx;
				width: 40rpx;
				height: 40rpx;
			}

			.cebtebtbox {
				width: 100%;

				.adresstext {
					width: 100%;
					font-size: 32rpx;
					color: #333333;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 1;
					-webkit-box-orient: vertical;
				}

				.adresslianxi {
					width: 100%;
					font-size: 28rpx;
					color: #999999;
					margin-top: 10rpx;
				}
			}

			.rightimage {
				position: absolute;
				right: 28rpx;
				width: 40rpx;
				height: 40rpx;
				padding: 10rpx 0;
				padding-left: 10rpx;
			}
		}
	}

	.content {
		width: 100%;
		min-height: 100vh;
		box-sizing: border-box;
		padding: 10rpx;
		padding-top: 20rpx;
		background: #F7F7F7;
		// padding-top: 20rpx;
		padding-bottom: 250rpx;
	}

	.dpigqb {
		.information {
			background: #FFFFFF;
			border-radius: 44rpx;
			// text-align: center;
			padding: 17.3rpx 0rpx 13rpx 0rpx;
			// padding: 17.3rpx 33rpx 2rpx 52.5rpx;
			box-sizing: border-box;
			margin-bottom: 20rpx;

			.number {
				display: flex;
				justify-content: space-between;
				color: #333333;
				font-size: 28rpx;
				font-weight: 400;
				padding: 0rpx 33rpx 15rpx 52.5rpx;
				border-bottom: 1rpx solid #3333334d;
				margin-bottom: 13rpx;
			}

			.numbera {
				display: flex;
				// justify-content: space-between;
				color: #333333;
				font-size: 28rpx;
				font-weight: 400;
				padding: 0rpx 33rpx 0rpx 52.5rpx;
			}

			.informationtitle {
				color: #333333;
				text-align: left;
				font-size: 32rpx;
				font-weight: 500;
				padding: 14rpx 33rpx 15.5rpx 52.5rpx;
				border-bottom: 4rpx solid #f6f6f6;
			}

			.introduce {
				display: flex;
				padding-top: 14rpx;
				margin-top: 15rpx;
				padding: 14rpx 33rpx 28.5rpx 52.5rpx;

				.img {
					width: 200rpx;
					height: 200rpx;
					margin-right: 28rpx;

					image {
						width: 200rpx;
						height: 200rpx;
					}
				}

				.introduce-text {
					width: 100%;

					.introduce-name {
						color: #333333;
						text-align: left;
						font-size: 28rpx;
						font-weight: 500;
						margin-top: 8rpx;
						margin-bottom: 16rpx;
					}

					.gift {
						color: #3333334d;
						font-size: 24rpx;
						font-weight: 500;
						margin-bottom: 28rpx;
					}

					.points {
						color: #3333334d;
						font-size: 24rpx;
						font-weight: 500;
						margin-bottom: 30rpx;
					}

					.introduce-price {
						display: flex;
						justify-content: space-between;
						align-items: center;

						.originalprice {
							color: #000000;
							font-size: 36rpx;
							font-weight: 700;
						}

						.multiple {
							color: #3333334d;
							font-size: 24rpx;
							font-weight: 500;
						}

						.presentprice {
							color: #33333399;
							font-size: 24rpx;
							font-weight: 400;
							display: flex;
							align-items: center;

							image {
								width: 26.09rpx;
								height: 26.09rpx;
							}

							text {
								margin: 0 10rpx;
							}
						}
					}
				}
			}
		}

		.payment {
			background: #FFFFFF;
			border-radius: 44rpx;
			margin-top: 25.5rpx;
			padding: 30.3rpx 0rpx 10rpx 0rpx;
			box-sizing: border-box;

			.lista {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 19rpx;
				padding: 0rpx 52rpx 32rpx 58.5rpx;
				border-bottom: 4rpx solid #f1f1f1;

				.title {
					color: #333333;
					font-size: 28rpx;
					font-weight: 400;
				}

				.moneyhong {
					display: flex;
					align-items: center;

					.orange {
						background: #ffedda;
						color: #ff9c34;
						padding: 8rpx 30rpx;
						font-size: 20rpx;
						font-weight: 400;
					}
				}
			}

			.listb {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 19rpx;
				padding: 0rpx 52rpx 0rpx 58.5rpx;

				.title {
					color: #333333;
					font-size: 28rpx;
					font-weight: 400;
				}

				.titlehui {
					color: #3333334d;
					font-size: 28rpx;
					font-weight: 400;
				}

				.moneyhong {
					color: #000000;
					font-size: 28rpx;
					font-weight: 400;
				}
			}

			.liste {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 19rpx;
				padding: 0rpx 52rpx 32rpx 58.5rpx;
				border-bottom: 4rpx solid #f1f1f1;

				.title {
					color: #333333fc;
					font-size: 28rpx;
					font-weight: 500;
				}

				.titlehui {
					color: #3333334d;
					font-size: 28rpx;
					font-weight: 400;
				}

				.moneyhong {
					color: #333333fc;
					font-size: 28rpx;
					font-weight: 500;
				}
			}

			.listf {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 19rpx;
				padding: 0rpx 52rpx 0rpx 58.5rpx;

				.title {
					color: #333333;
					font-size: 28rpx;
					font-weight: 400;
				}

				.titlehui {
					color: #3333334d;
					font-size: 28rpx;
					font-weight: 400;
				}

				.moneyhong {
					color: #333333fc;
					font-size: 28rpx;
					font-weight: 500;

					text {
						color: #d73c38;
						font-size: 28rpx;
						font-weight: 700;
					}
				}
			}

			.listc {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 19rpx;
				padding: 0rpx 52rpx 40rpx 58.5rpx;
				border-bottom: 4rpx solid #f1f1f1;

				.title {
					display: flex;
					align-items: center;
					color: #333333;
					font-size: 28rpx;
					font-weight: 400;

					.zfb {
						width: 64rpx;
						height: 64rpx;
						margin-right: 26rpx;
					}
				}

				.moneyhong {
					width: 50rpx;
					height: 50rpx;

					image {
						width: 50rpx;
						height: 50rpx;
					}
				}
			}

			.listd {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 19rpx;
				padding: 0rpx 52rpx 0rpx 58.5rpx;

				.title {
					display: flex;
					align-items: center;
					color: #333333;
					font-size: 28rpx;
					font-weight: 400;

					.wx {
						width: 64rpx;
						height: 64rpx;
						margin-right: 26rpx;
					}
				}

				.moneyhong {
					width: 50rpx;
					height: 50rpx;

					image {
						width: 50rpx;
						height: 50rpx;
					}
				}
			}
		}
	}

	.bottom {
		width: 100vw;
		position: fixed;
		bottom: 0;
		left: 0;
		background: #FFFFFF;
		// margin-top: 25.5rpx;
		padding: 30.3rpx 52rpx 50rpx 58.5rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.money {
			color: #9e9e9e;
			font-size: 28rpx;
			font-weight: 500;

			.hong {
				color: #f8492e;
				font-size: 40rpx;
				font-weight: 700;
			}
		}

		button {
			width: 333.07rpx;
			height: 84.12rpx;
			border-radius: 704rpx;
			background: #ff9c33;
			color: #ffffff;
			text-align: center;
			line-height: 84rpx;
			font-size: 32rpx;
			font-weight: 700;
		}
	}
</style>